package online.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import common.db.JdbcSource;
import common.db.dao.DaoUtil;

/**
 * ドライバ抹消リスナ
 *
 * @author Tadashi Nakayama
 */
public final class DeregisterListener implements ServletContextListener {

	/**
	 * @see javax.servlet.ServletContextListener
	 * #contextDestroyed(javax.servlet.ServletContextEvent)
	 */
	@Override
	public void contextDestroyed(final ServletContextEvent arg0) {
		JdbcSource.deregister(this.getClass().getClassLoader());
	}

	/**
	 * @see javax.servlet.ServletContextListener
	 * #contextInitialized(javax.servlet.ServletContextEvent)
	 */
	@Override
	public void contextInitialized(final ServletContextEvent arg0) {
		DaoUtil.addClassPath(this.getClass());
	}
}
